import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Salud here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class SaludL extends Actor
{
    private int NUM = 11;
    private final GreenfootImage[] Barra = new GreenfootImage[NUM];
    private Ninja ninja;
    public SaludL(){
         
      for(int i = 0; i<NUM; i++)
          Barra[i] = new GreenfootImage("BarraSalud"+i+".png");
    }
    
    /**
     * Act - do whatever the Salud wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        Niveles mundo = (Niveles)this.getWorld();
        ninja = mundo.ninja;
        int salud = ninja.rsalud();
        
        switch(salud){
          case 100: setImage(Barra[10]);
                    break;
          case 90: setImage(Barra[9]);
                    break;
          case 80: setImage(Barra[8]);
                    break;          
          case 70: setImage(Barra[7]);
                    break;
          case 60: setImage(Barra[6]);
                    break;
          case 50: setImage(Barra[5]);
                    break;
          case 40: setImage(Barra[4]);
                    break;
          case 30: setImage(Barra[3]);
                    break;
          case 20: setImage(Barra[2]);
                    break;
          case 10: setImage(Barra[1]);
                    break;
          case 0: setImage(Barra[0]);
                    break;          
                }
          
         
    }    
}
